import os
from flask import Flask
import mysql.connector

app = Flask(__name__)


@app.route('/')
def index():
    db = mysql.connector.connect(
        # host=os.environ.get('DB_HOST'),
        # user=os.environ.get('DB_USER'),
        # password=os.environ.get('DB_PASSWORD'),
        # database=os.environ.get('DB_NAME')
        host="192.168.1.108",
        user="root",
        password="root",
        database="viper"
    )
    cursor = db.cursor()
    # cursor.execute("SELECT * FROM sys_func")
    cursor.execute("SELECT * FROM sys_func_roles_link")

    results = cursor.fetchall()
    return str(results)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)
